﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Utilities.QuickSql;
using MySql.Data;

namespace Deviseur_Cs2i_Car
{
    class TYPE
    {
        int NumType;
        string LibelleType;
        string DescriptionType;

        public TYPE() { }
        public TYPE(int NumType)
        {
            this.NumType = NumType;
        }

        public TYPE(string LibelleType, string DescrType)
        {
            this.LibelleType = LibelleType;
            this.DescriptionType = DescrType;
        }

        public TYPE(int NumType, string LibelleType, string DescrType)
        {
            this.NumType = NumType;
            this.LibelleType = LibelleType;
            this.DescriptionType = DescrType;
        }

        public int get_NumType()
        {
            return this.NumType;
        }
        public string get_LibelleType()
        {
            return this.LibelleType;
        }
        public void set_NumType(int NumType)
        {
            this.NumType = NumType;
        }
        public void set_LibelleType(string LibelleType)
        {
            this.LibelleType = LibelleType;
        }
        public void set_DescriptionType(string DescriptionType)
        {
            this.DescriptionType = DescriptionType;
        }
        public void affiche_Type()
        {
            Console.WriteLine("Num Type : ", this.NumType);
            Console.WriteLine("Libelle Type : ", this.LibelleType);
        }
        public void new_Type()
        {
            Program.Db.Execute("INSERT INTO TYPE (LibelleType, DescriptionType) VALUES ('" + this.LibelleType + "', '" + this.DescriptionType + "')");
        }
        public void modify_Type()
        {
            Program.Db.Execute("UPDATE TYPE SET LibelleType = '" + this.LibelleType + "', DescriptionType = '" + this.DescriptionType +"' WHERE NumType = " + this.NumType);
        }
        public void delete_Type(int NumType)
        {
            Program.Db.Execute("DELETE FROM TYPE WHERE NumType = " + NumType);            
        }
    }
}
